﻿#include "SARibbonBarHelper.h"
#include "MainWindow.h"

#include "FITK_Kernel/FITKCore/FITKEnumTransformer.hpp"

#include <QObject>

#include <SARibbonBar.h>
#include <SARibbonApplicationButton.h>
#include <SARibbonQuickAccessBar.h>
#include <SARibbonTabBar.h>
namespace GUI
{
    int SARibbonBarHelper::_gategoryIndex = -1;

    SARibbonBarHelper::SARibbonBarHelper(MainWindow* mw)
        :_mainWindow(mw)
    {
        if (_mainWindow == nullptr) return;

        _ribbonBar = _mainWindow->ribbonBar();
        if (_ribbonBar == nullptr) return;
        //使用Office2013风格
        sa_set_ribbon_theme(_ribbonBar, SARibbonTheme::RibbonThemeOffice2013);

        //设置顶部线条颜色
        _ribbonBar->setTabBarBaseLineColor(QColor(186, 201, 219));
        _ribbonBar->setRibbonStyle(SARibbonBar::RibbonStyleLooseThreeRow);
        _ribbonBar->setWindowTitleTextColor(QColor(0, 0, 0));
    }

    QAction* SARibbonBarHelper::CreateAction(const QString& text, const QString & name, const QString& icon, QWidget* p)
    {
        QAction* ac = new QAction(p);
        ac->setText(text);
        ac->setObjectName(name);
        ac->setIcon(QIcon(icon));
        return ac;
    }

    void SARibbonBarHelper::initRibbonBar()
    { 
        if (_ribbonBar == nullptr) return;
        //开始按钮
        this->initRibbonBarStartButton();
        //不同的Panel页面
        this->initRibbonBarFile();
        this->initRibbonBarEdit();
        this->initRibbonBarGeo();
        this->initRibbonBarMaterial();
        this->initRibbonBarPhysicalProp();
        this->initRibbonBarSubSys();
        this->initRibbonBarJunction();
        this->initRibbonBarLoad();
        this->initRibbonBarSolveAndResult();
        this->initRibbonBarScript();
        this->initRibbonBarTool();
        this->initRibbonBarWindow();
        this->initRibbonBarHelp();
        //设置当前页为File页面
        SARibbonCategory* c = _ribbonBar->categoryByIndex(0);
        if(c) _ribbonBar->showCategory(c);
    }

    void SARibbonBarHelper::switchToModule(GUIModuleType module)
    {
        if (_ribbonBar == nullptr)return;
        Core::FITKEnumTransfer<GUIModuleType> transfer;
        bool ok = false;
        QString type = transfer.toStrting(module, ok);
        int index = _gategoryHash.value(type);
        _ribbonBar->setCurrentIndex(index);
    }

    SARibbonBarHelper::GUIModuleType SARibbonBarHelper::getCurrentModuleType()
    {
        if (_ribbonBar == nullptr)return GUIModuleType::None;
        int index = _ribbonBar->currentIndex();
        QString type = _gategoryHash.key(index);
        Core::FITKEnumTransfer<GUIModuleType> transfer;
        bool ok = false;
        GUIModuleType typeEnum = transfer.fromString(type, ok);
        return typeEnum;
    }

    void SARibbonBarHelper::initRibbonBarStartButton()
    {
        if (_ribbonBar == nullptr) return;
        //开始按钮
        QAbstractButton* startButton = _ribbonBar->applicationButton();
        startButton->setText(QObject::tr("Start"));
        startButton->setFixedWidth(60);
        //工作路径
        QAction* act = CreateAction(QObject::tr("Working Dir"), "actionWorkingDir", "", _mainWindow);
        startButton->addAction(act);
        //脚本相关设置
        act = CreateAction(QObject::tr("Record Script"), "actionRecordScript", "", _mainWindow);
        startButton->addAction(act);
        act = CreateAction(QObject::tr("End Script"), "actionEndScript", "", _mainWindow);
        act->setEnabled(false);
        startButton->addAction(act);
        act = CreateAction(QObject::tr("Run Script"), "actionRunScript", "", _mainWindow);
        startButton->addAction(act);
    }

    void SARibbonBarHelper::initRibbonBarFile()
    {
        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::File);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("File"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        //项目
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Project"));
        action = CreateAction(QObject::tr("New"), "actionNew", ":/ToolBar/toolBar/new.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Open"), "actionOpen", ":/ToolBar/toolBar/open.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Recent"), "actionRecent", ":/ToolBar/toolBar/recent.png", _mainWindow);
        QMenu * menu = new QMenu(QObject::tr("Recent"),_mainWindow);
        action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);
        
        action = CreateAction(QObject::tr("Save"), "actionSave", ":/ToolBar/toolBar/save.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Save As"), "actionSaveAs", ":/ToolBar/toolBar/save_as.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Exit"), "actionExit", ":/ToolBar/toolBar/close.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Project Property"), "actionProperty", ":/ToolBar/toolBar/property.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);

        //导入
        pannel = gategory->addPannel(QObject::tr("Import"));
        action = CreateAction(QObject::tr("Model"), "", ":/ToolBar/toolBar/XML_import.png", _mainWindow);
        menu = new QMenu(QObject::tr("Model"), _mainWindow);
            QAction *action_XML_import = CreateAction(QObject::tr("XML Model"), "actionImportVAOneXML", ":/ToolBar/toolBar/XML_import.png", _mainWindow);
            QAction *action_CabinNoise_import = CreateAction(QObject::tr("CN Model"), "actionImportVAOneCabinNoise", ":/ToolBar/toolBar/cabin_noise_import.png", _mainWindow);
            menu->addAction(action_XML_import);
            menu->addAction(action_CabinNoise_import);
        action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Mesh"), "actionImportNastranBDF", ":/ToolBar/toolBar/BDF.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Geometry"), "", ":/ToolBar/toolBar/CAD_DXF.png", _mainWindow);
        menu = new QMenu(QObject::tr("Geometry"), _mainWindow);
            QAction *action_cad_dxf = CreateAction(QObject::tr("CAD-DXF File"), "actionImportCAD_DXFGeometry", ":/ToolBar/toolBar/CAD_DXF.png", _mainWindow);
            QAction *action_step = CreateAction(QObject::tr("STEP File"), "actionImportGeometry", ":/ToolBar/toolBar/STEP.png", _mainWindow);
            /*connect(action_cad_dxf, SIGNAL(triggered()), this, SLOT(slot()));
            connect(action_step, SIGNAL(triggered()), this, SLOT(slot()));*/
            menu->addAction(action_cad_dxf);
            menu->addAction(action_step);
        action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Result"), "", ":/ToolBar/toolBar/structure_FE_result.png", _mainWindow);
        menu = new QMenu(QObject::tr("Result"), _mainWindow);
            QAction *action_structure_FE = CreateAction(QObject::tr("Structure FE"), "actionStructureFEResult", ":/ToolBar/toolBar/structure_FE_result.png", _mainWindow);
            QAction *action_acoustic_FE = CreateAction(QObject::tr("Acoustic FE"), "actionAcousticFEResult", ":/ToolBar/toolBar/acoustic_FE_result.png", _mainWindow);
            QAction *action_CSV = CreateAction(QObject::tr("CSV File"), "actionCSVResult", ":/ToolBar/toolBar/CSV_result.png", _mainWindow);
            QAction *action_VTK = CreateAction(QObject::tr("VTK File"), "actionVTKResult", ":/ToolBar/toolBar/VTK_result.png", _mainWindow);
            QAction *action_HDF5 = CreateAction(QObject::tr("HDF5 File"), "actionHDF5Result", ":/ToolBar/toolBar/HDF5_result.png", _mainWindow);
            menu->addAction(action_structure_FE);
            menu->addAction(action_acoustic_FE);
            menu->addAction(action_CSV);
            menu->addAction(action_VTK);
            menu->addAction(action_HDF5);
        action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);

        //导出
        pannel = gategory->addPannel(QObject::tr("Export"));
        action = CreateAction(QObject::tr("XML Model"), "actionExportVAOneXML", ":/ToolBar/toolBar/XML_modul_export.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Mesh"), "actionExportNastranBDF", ":/ToolBar/toolBar/BDF.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("STEP File"), "actionExportSTEPFile", ":/ToolBar/toolBar/STEP_export.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Result"), "", ":/ToolBar/toolBar/HDF5_export.png", _mainWindow);
        menu = new QMenu(QObject::tr("Result"), _mainWindow);
            //QAction *action_HDF5_export = CreateAction(QObject::tr("HDF5 File"), "actionExportHDF5Result", ":/ToolBar/toolBar/HDF5_export.png", _mainWindow);
            QAction *action_VTK_export = CreateAction(QObject::tr("VTK File"), "actionAcousticFEResult", ":/ToolBar/toolBar/VTK_export.png", _mainWindow);
            //menu->addAction(action_HDF5_export);
            menu->addAction(action_VTK_export);
        action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::initRibbonBarEdit()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Edit);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Edit"));
        _ribbonBar->raiseCategory(gategory);

        QAction* action = nullptr;
        //编辑
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Edit"));
        action = CreateAction(QObject::tr("Undo"), "actionUndo", ":/ToolBar/toolBar/undo.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Redo"), "actionRedo", ":/ToolBar/toolBar/redo.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Delete"), "actionDelete", ":/ToolBar/toolBar/delete.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Cut"), "actionCut", ":/ToolBar/toolBar/cut.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Copy"), "actionCopy", ":/ToolBar/toolBar/copy.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Paste"), "actionPaste", ":/ToolBar/toolBar/paste.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Special Paste"), "actionSpecialPaste", ":/ToolBar/toolBar/special_paste.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Copy As Text"), "actionCopyAsText", ":/ToolBar/toolBar/copy_as_text.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Preference"), "actionPreference", ":/ToolBar/toolBar/preference.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);

    }

    void SARibbonBarHelper::initRibbonBarGeo()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Geo);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Geometry"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        //点建模
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Node Model"));
        action = CreateAction(QObject::tr("Coord"), "actionNodeCoord", ":/ToolBar/toolBar/Coord.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Node of Intersection"), "actionNodeOfIntersection", ":/ToolBar/toolBar/Node_of_Intersection.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Center of Sphere/Circle"), "actionNodeCenterSphere/Circle", ":/ToolBar/toolBar/Center_of_SphereCircle.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Equidistant Nodes on the Line"), "actionNodeEquidistantNodesLine", ":/ToolBar/toolBar/Equidistant_Nodes_on_the_Line.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //线建模
        pannel = gategory->addPannel(QObject::tr("Line Model"));
        action = CreateAction(QObject::tr("Nodes"), "actionLineNodes", ":/ToolBar/toolBar/Nodes.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Vertical Line"), "actionLineVerticalLine", ":/ToolBar/toolBar/Vertical_Line.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //面建模
        pannel = gategory->addPannel(QObject::tr("Plane Model"));
        action = CreateAction(QObject::tr("Stretch"), "actionPlane", ":/ToolBar/toolBar/Stretch_plane.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Wireframe"), "actionPlaneWireframe", ":/ToolBar/toolBar/Wireframe.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Mesh"), "actionMeshGen", ":/ToolBar/toolBar/Mesh.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Spin"), "actionPlane", ":/ToolBar/toolBar/Spin.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Scan"), "actionPlane", ":/ToolBar/toolBar/Scan.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Lofting"), "actionPlane", ":/ToolBar/toolBar/Lofting.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //体建模
        pannel = gategory->addPannel(QObject::tr("Solid Model"));
        action = CreateAction(QObject::tr("Choose Plane"), "actionSolidChoosePlane", ":/ToolBar/toolBar/Choose_Plane.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Lofting"), "actionSolidLofting", ":/ToolBar/toolBar/Lofting_solid.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //向量
        pannel = gategory->addPannel(QObject::tr("Vector"));
        action = CreateAction(QObject::tr("Two Nodes"), "actionVector", ":/ToolBar/toolBar/Two_Nodes.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Direction of Node"), "actionVector", ":/ToolBar/toolBar/Direction_of_Node.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Line Segment"), "actionVector", ":/ToolBar/toolBar/Line_Segment.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //几何运算
        pannel = gategory->addPannel(QObject::tr("Geometric Operations"));
        action = CreateAction(QObject::tr("Bool"), "actionGeometricOperations", ":/ToolBar/toolBar/Bool.png", _mainWindow);
            QMenu *boolMenu = new QMenu(QObject::tr("Bool"), _mainWindow);
            QAction *action_Unite = CreateAction(QObject::tr("Unite"), "actionGeometricOperationsUnite", ":/ToolBar/toolBar/Node_Node.png", _mainWindow);
            QAction *action_Intersect = CreateAction(QObject::tr("Intersect"), "actionGeometricOperationsIntersect", ":/ToolBar/toolBar/Node_Line.png", _mainWindow);
            QAction *action_Subtract = CreateAction(QObject::tr("Subtract"), "actionGeometricOperationsSubtract", ":/ToolBar/toolBar/Plants.png", _mainWindow);
            boolMenu->addAction(action_Unite);
            boolMenu->addAction(action_Intersect);
            boolMenu->addAction(action_Subtract);
            action->setMenu(boolMenu);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Cut Plane"), "", ":/ToolBar/toolBar/Node_Node.png", _mainWindow);
            QMenu *menu = new QMenu(QObject::tr("Cut Plane"), _mainWindow);
            QAction *action_Node_Node = CreateAction(QObject::tr("Node Node"), "actionGeometricOperationsNodeNode", ":/ToolBar/toolBar/Node_Node.png", _mainWindow);
            QAction *action_Node_Line = CreateAction(QObject::tr("Node Line"), "actionGeometricOperationsNodeLine", ":/ToolBar/toolBar/Node_Line.png", _mainWindow);
            QAction *action_Plants = CreateAction(QObject::tr("Plants"), "actionGeometricOperationsPlants", ":/ToolBar/toolBar/Plants.png", _mainWindow);
            menu->addAction(action_Node_Node);
            menu->addAction(action_Node_Line);
            menu->addAction(action_Plants);
            action->setMenu(menu);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Body of Face"), "actionGeometricOperationsBodyFace", ":/ToolBar/toolBar/Body_of_Face.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //自由边检查
        pannel = gategory->addPannel(QObject::tr("Model Check"));
        action = CreateAction(QObject::tr("FreeEdge Check"), "actionModelFreeEdgeCheck", ":/ToolBar/toolBar/freeEdge_check.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);

        //特征创建 按钮图标暂无先用其他的用着
        pannel = gategory->addPannel(QObject::tr("Feature creation")); 
        action = CreateAction(QObject::tr("Stretch"), "actionStretch", ":/ToolBar/toolBar/Choose_Plane.png", _mainWindow);//拉伸
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Rotate"), "actionRotate", ":/ToolBar/toolBar/Choose_Plane.png", _mainWindow);//旋转
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Sweep"), "actionSweep", ":/ToolBar/toolBar/Choose_Plane.png", _mainWindow);//扫掠
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Lofting"), "actionLofting", ":/ToolBar/toolBar/Choose_Plane.png", _mainWindow);//放样
        pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::initRibbonBarMaterial()
    {
        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Material);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Material"));
        _ribbonBar->raiseCategory(gategory);

        QAction* action = nullptr;
        //材料
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Material"));
        action = CreateAction(QObject::tr("Fluid"), "actionFluid", ":/browserIcons/fluid.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Isotropic Solids"), "actionIsosolid", ":/browserIcons/isoSoild.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Visco-Elastic Solids"), "actionViscoElastic", ":/browserIcons/viscoElasticSoild.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Foam"), "actionFoam", ":/browserIcons/foam.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Fibers"), "actionFiber", ":/browserIcons/fiber.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("FE Material Cards [MID]"), "actionFEMaterials", ":/browserIcons/FEMaterial.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        /*action = CreateAction(QObject::tr("List"), "actionMaterialList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/

        pannel = gategory->addPannel(QObject::tr("Noise Control Treatment"));
        action = CreateAction(QObject::tr("Treatment Lay-Up"), "actionTreatment", ":/browserIcons/lay_Up.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("User Define Treatment"), "actionUserDefineTreatment", ":/browserIcons/userDefinedNoise.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Multiple Noise Control Treatment"), "actionMultipleNoiseControlTreatment", ":/browserIcons/multipleNoise.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
       /* action = CreateAction(QObject::tr("List"), "actionNCTList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/
    }

    void SARibbonBarHelper::initRibbonBarPhysicalProp()
    {
        if (_mainWindow == nullptr) return;
        recordGategoryIndex(GUIModuleType::PhysicalProp);
        SARibbonBar* ribbonBar = _mainWindow->ribbonBar();
        SARibbonCategory* gategory = ribbonBar->addCategoryPage(QObject::tr("Property"));
        _ribbonBar->raiseCategory(gategory);

        QAction* action = nullptr;
        //物理属性
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Property"));
        action = CreateAction(QObject::tr("Beams"), "actionBeams", ":/browserIcons/beam.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Uniform"), "actionUniform", ":/browserIcons/uniform.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("General Laminate"), "actionGeneralLaminate", ":/browserIcons/generalLaminate.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Ribbed"), "actionRibbed", ":/browserIcons/ribbed.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("FE Property Cards [PID]"), "actionFEProperty", "", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        /*action = CreateAction(QObject::tr("List"), "actionPropertyList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/

        pannel = gategory->addPannel(QObject::tr("Spectra"));
        action = CreateAction(QObject::tr("Damping Loss Factor"), "actionDampingLossFactor", ":/browserIcons/dampingLossFactor.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Absorption Coefficient"), "actionAbsorptionCoefficient", ":/browserIcons/absorptionCoefficient.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Modal Density"), "actionModalDensity", ":/browserIcons/modalDensity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Wavenumber"), "actionWavenumber", ":/browserIcons/wavemunber.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Coupling Loss Factor"), "actionCouplingLossFactor", ":/browserIcons/couplingLossFactor.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Transmission Loss"), "actionTransmissionLoss", ":/browserIcons/transmissionLoss.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Insertion Loss"), "actionInsertionLoss", ":/browserIcons/insertionLoss.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Shear Modulus"), "actionShearModulus", ":/browserIcons/shearModulus.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("List"), "actionSpectraList", ":/ToolBar/toolBar/list.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::initRibbonBarSubSys()
    {
        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::SubSys);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("SubSystem"));
        _ribbonBar->raiseCategory(gategory);

        QAction* action = nullptr;
        //SEA子系统
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("SEA"));
        action = CreateAction(QObject::tr("Auto-Shell"), "actionAutoGenerateShell", ":/ToolBar/toolBar/auto_shell.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Auto-Cavity"), "actionAutoGenerateCavity", ":/ToolBar/toolBar/auto_cavity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Beam"), "actionCreateBeam", ":/ToolBar/toolBar/SEA_beam.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Flat Plate"), "actionCreateFlatPlate", ":/ToolBar/toolBar/SEA_flat_plate.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Single Curvature Shell"), "actionCreateSinglyCurvedShell", ":/ToolBar/toolBar/SEA_single_curvature_plate.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Double Curvature Shell"), "actionCreateDoubleCurvedShell", ":/ToolBar/toolBar/SEA_double_curvature_plate.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Acoustic Cavities"), "actionCreateCavity", ":/ToolBar/toolBar/SEA_cavity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Semi Infinite Fluid"), "actionCreateSemiInfiniteFluid", ":/ToolBar/toolBar/SEA_semi_infinite_fluid.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Semi Infinite Fluid Connect"), "actionConnectSemiInfiniteFluid", ":/ToolBar/toolBar/SEA_semi_infinite_fluid_connect.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
       /* action = CreateAction(QObject::tr("List"), "actionSEAList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/

        pannel = gategory->addPannel(QObject::tr("FE"));
        action = CreateAction(QObject::tr("Structural FE Subsystem"), "actionCreateStructFESubsys", ":/ToolBar/toolBar/FE_structural_subsystem.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Acoustic FE Subsystems"), "actionCreateAcousticFESubsys", ":/ToolBar/toolBar/FE_cavity_subsystem.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("Creat FE Face"), "actionCreateFEFace", ":/ToolBar/toolBar/FE_creat_face.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("FE Sensor"), "actionCreateFESensor", ":/ToolBar/toolBar/FE_transducer.png", _mainWindow);
        action->setCheckable(true);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Remsh FE Subsystems"), "actionRemshFESubsystems", ":/ToolBar/toolBar/FE_redistribute_mesh.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Subsystem Blend"), "actionSubsystemBlend", ":/ToolBar/toolBar/FE_subsystem_blend.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
       /* action = CreateAction(QObject::tr("List"), "actionFEList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/

        pannel = gategory->addPannel(QObject::tr("FreeEdge"));
        action = CreateAction(QObject::tr("FreeEdge Check"), "actionFreeEdgeCheck", ":/ToolBar/toolBar/freeEdge_check.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        this->checkActionSingly(QList< QAction* >() << action);
    }

    void SARibbonBarHelper::initRibbonBarJunction()
    {
        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Junction);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Junction"));
        _ribbonBar->raiseCategory(gategory);

        QAction* action = nullptr;
        SARibbonPannel* pannel = nullptr;
        //自动连接
        pannel = gategory->addPannel(QObject::tr("Automatic"));
        action = CreateAction(QObject::tr("Auto Junctions"), "actionAutoJunctions", ":/ToolBar/toolBar/auto_Junctions.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Bulk Deletion Point"), "actionDeleteBatchPoint", ":/ToolBar/toolBar/delete_batch_point.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Bulk Deletion Line"), "actionDeleteBatchLine", ":/ToolBar/toolBar/delete_batch_line.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Bulk Deletion Area"), "actionDeleteBatchArea", ":/ToolBar/toolBar/delete_batch_area.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //手动连接
        pannel = gategory->addPannel(QObject::tr("Manual"));
        action = CreateAction(QObject::tr("Point"), "actionCreateJunctionPoint", ":/ToolBar/toolBar/Junction_point.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Line"), "actionCreateJunctionLine", ":/ToolBar/toolBar/Junction_line.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Area"), "actionCreateJunctionArea", ":/ToolBar/toolBar/Junction_area.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
       /* action = CreateAction(QObject::tr("Double Wall Junction"), "actionDoubleWall", ":/ToolBar/toolBar/double_wall.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/
        ////手动连接
        //pannel = gategory->addPannel(QObject::tr("Hybrid Manual"));
        //action = CreateAction(QObject::tr("Hybrid Point"), "actionCreateHybridJunctionPoint", ":/ToolBar/toolBar/Junction_point.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("Hybrid Line"), "actionCreateHybridJunctionLine", ":/ToolBar/toolBar/Junction_line.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("Hybrid Area"), "actionCreateHybridJunctionArea", ":/ToolBar/toolBar/Junction_area.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        ////手动连接
        //pannel = gategory->addPannel(QObject::tr("FE Manual"));
        //action = CreateAction(QObject::tr("FE Point"), "actionCreateFEJunctionPoint", ":/ToolBar/toolBar/Junction_point.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("FE Line"), "actionCreateFEJunctionLine", ":/ToolBar/toolBar/Junction_line.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("FE Area"), "actionCreateFEJunctionArea", ":/ToolBar/toolBar/Junction_area.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);
        
    }

    void SARibbonBarHelper::initRibbonBarLoad()
    {
        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Load);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Load"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        //  载荷数据
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Load Data"));
        action = CreateAction(QObject::tr("Velocity"), "actionLoadVpeed", ":/ToolBar/toolBar/Velocity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Angular Velocity"), "actionLoadAngularVelocity", ":/ToolBar/toolBar/Angular_Velocity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Accelerated Velocity"), "actionLoadAcceleratedVelocity", ":/ToolBar/toolBar/Accelerated_Velocity.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Force"), "actionLoadForce", ":/ToolBar/toolBar/Force.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Moment"), "actionLoadMoment", ":/ToolBar/toolBar/Moment.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Pressure"), "actionLoadSoundPressure", ":/ToolBar/toolBar/Sound_Pressure.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Energy"), "actionLoadEnergy", ":/ToolBar/toolBar/Energy.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Power"), "actionLoadPower", ":/ToolBar/toolBar/Power.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //action = CreateAction(QObject::tr("List View"), "actionLoadListView", ":/ToolBar/toolBar/load_list_view.png", _mainWindow);
        //pannel->addAction(action, SARibbonPannelItem::Large);

        
        QList< QAction* > actionList;
        pannel = gategory->addPannel(QObject::tr("Defining Load"));
        action = CreateAction(QObject::tr("Power"), "actionCreateLoad", ":/ToolBar/toolBar/Power.png", _mainWindow);
        action->setData(0);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Point Force & Moments"), "actionCreateLoad", ":/ToolBar/toolBar/Load_Force_and_Moment.png", _mainWindow);
        action->setData(1);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Constraint"), "actionCreateLoad", ":/ToolBar/toolBar/load_Constraint.png", _mainWindow);
        action->setData(2);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Import HVAC Noise"), "actionCreateLoad", ":/ToolBar/toolBar/Import_HVAC_Noise.png", _mainWindow);
        action->setData(3);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Monopole"), "actionCreateLoad", "", _mainWindow);
        action->setData(4);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
      /*  action = CreateAction(QObject::tr("List"), "actionDefiningLoadList", ":/ToolBar/toolBar/list.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);*/

        this->checkActionSingly(actionList);
    }

    void SARibbonBarHelper::initRibbonBarSolveAndResult()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::SolveAndResult);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Solve & Result"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        // 求解
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Solve"));
        action = CreateAction(QObject::tr("Frequency Domain Options"), "actionFrequencyRangeOptions", ":/ToolBar/toolBar/FrequencyRange_Options.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Solve Options"), "actionSolveOptions", ":/ToolBar/toolBar/Solve_Options.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Load Case"), "actionLoadCaseDef", ":/ToolBar/toolBar/Working_Condition_Def.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Solve"), "actionSolveSolve", ":/ToolBar/toolBar/Solve.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //结果
        pannel = gategory->addPannel(QObject::tr("Result"));
        action = CreateAction(QObject::tr("Spectrogram"), "actionSpectrogramResult", ":/ToolBar/toolBar/Spectrogram_result.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Vibrancy Spectrogram"), "actionVibrancySpectrogramResult", ":/ToolBar/toolBar/Vibrancy_Spectrogram.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Noise Spectrogram"), "actionNoiseSpectrogramResult", ":/ToolBar/toolBar/Noise_Spectrogram.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Semi-infinite fluid Noise"), "actionSemi_infiniteFluidNoise", ":/ToolBar/toolBar/Semi-infinite_fluid_Noise.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Generate Report"), "actionGenerateReport", ":/ToolBar/toolBar/Generate_Report.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        //中间量
        QList< QAction* > actionList;
        pannel = gategory->addPannel(QObject::tr("Intermediate Amount"));
        action = CreateAction(QObject::tr("Modal Density"), "actionModalDensityResult", "", _mainWindow);
        action->setData(0);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Loss Factor"), "actionLossFactorResult", "", _mainWindow);
        action->setData(1);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Coupling Loss Factor"), "actionCouplingLossFactorResult", "", _mainWindow);
        action->setData(2);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);
        action = CreateAction(QObject::tr("Radiation Efficiency"), "actionRadiationEfficiencyResult", "", _mainWindow);
        action->setData(3);
        pannel->addAction(action, SARibbonPannelItem::Large);
        actionList.append(action);

        this->checkActionSingly(actionList);
    }

    void SARibbonBarHelper::initRibbonBarScript()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Script);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Script"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        //  脚本
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Script"));
        action = CreateAction(QObject::tr("New"), "actionScriptNew", ":/ToolBar/toolBar/new.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Edit"), "actionScriptEdit", ":/ToolBar/toolBar/edit.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Debug"), "actionScriptDebug", ":/ToolBar/toolBar/debug.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Run"), "actionScriptRun", ":/ToolBar/toolBar/run.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::initRibbonBarTool()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Tool);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Tool"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        // 工具
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Tool"));
        action = CreateAction(QObject::tr("Statistics"), "actionToolStatistics", ":/ToolBar/toolBar/Statistics.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Model Location"), "actionToolModelLocation", ":/ToolBar/toolBar/Model_Location.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Translate"), "actionToolTranslate", ":/ToolBar/toolBar/Translate.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Rotation"), "actionToolRotation", ":/ToolBar/toolBar/Rotation.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Scale"), "actionToolScale", ":/ToolBar/toolBar/Zoom.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Mirror"), "actionToolMirror", ":/ToolBar/toolBar/Mirror.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Array"), "actionToolArray", ":/ToolBar/toolBar/Array.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Translation"), "actionToolTranslation", ":/ToolBar/toolBar/Translation.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Mesh Mass Check"), "actionMeshCheck", ":/ToolBar/toolBar/Rotation.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);

        pannel = gategory->addPannel(QObject::tr("Edit"));
        action = CreateAction(QObject::tr("Delete"), "actionDelete", ":/ToolBar/toolBar/delete.png", _mainWindow);
        action->setShortcut(Qt::Key_F2);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Visibility"), "actionVisibility", "", _mainWindow);
        action->setShortcut(Qt::Key_F5);
        pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::initRibbonBarWindow()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Window);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Window"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        //窗口
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Window"));
        action = CreateAction(QObject::tr("Creat"), "actionWindowCreat", "", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Delete"), "actionWindowDelete", ":/ToolBar/toolBar/delete.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Tile Horizontal"), "actionWindowTileHorizontal", ":/ToolBar/toolBar/Tile_Horizontal.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Tile Vertical"), "actionWindowTilingVertical", ":/ToolBar/toolBar/Tile_Vertical.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Cascade"), "actionWindowCascade", ":/ToolBar/toolBar/Stack.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("Manage"), "actionWindowManage", ":/ToolBar/toolBar/Manage.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);

    }

    void SARibbonBarHelper::initRibbonBarHelp()
    {

        if (_ribbonBar == nullptr) return;
        recordGategoryIndex(GUIModuleType::Help);
        SARibbonCategory* gategory = _ribbonBar->addCategoryPage(QObject::tr("Help"));
        _ribbonBar->raiseCategory(gategory);
        QAction* action = nullptr;
        // 帮助
        SARibbonPannel* pannel = gategory->addPannel(QObject::tr("Help"));
        action = CreateAction(QObject::tr("Direction"), "actionHelpDirection", ":/ToolBar/toolBar/Direction.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("QA"), "actionHelpQA", ":/ToolBar/toolBar/QA.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
        action = CreateAction(QObject::tr("About"), "actionHelpAbout", ":/ToolBar/toolBar/about.png", _mainWindow);
        pannel->addAction(action, SARibbonPannelItem::Large);
    }

    void SARibbonBarHelper::checkActionSingly(QList< QAction* > actionList)
    {
        for (QAction* action : actionList)
        {
            if (!action) continue;
            action->setCheckable(true);
            QObject::connect(action, &QAction::toggled, [=](bool checked) {
                if (!checked)return;
                for (QAction* actionT : actionList)
                {
                    if (!actionT || actionT == action) continue;
                    actionT->setChecked(false);
                }
            });
        }
    }

    void SARibbonBarHelper::recordGategoryIndex(GUIModuleType type)
    {
        Core::FITKEnumTransfer<GUIModuleType> transfer;
        bool ok = false;
        QString typeStr = transfer.toStrting(type, ok);
        //获取Gategory索引
        _gategoryIndex++;
        _gategoryHash.insert(typeStr, _gategoryIndex);
    }
}



